package com.jgsu.farm.mapper;

import com.jgsu.farm.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: farm-10-14-2019
 * @description: 普通用户的数据层
 * @author: Mr.zuo
 * @create: 2019-12-06 18:42
 **/
@Repository
public interface GeneralUserMapper {
    /**
     *查询所有普通用户
     * */
    @Select("select * from user where role = #{role}")
    List<User> selectList(Integer role);

    @Update("update user set userID = #{userid},password = #{password},name = #{name},nickname = #{nickname},email = #{email},postcode = #{postcode},photo = #{photo},introduction = #{introduction} where phone = #{phone}")
    void updateGeneral(User user);

    /**
     * 根据手机号删除用户信息
     * @Param phone：手机号
     * */
    @Delete("delete from user where phone = #{phone}")
    int deleteGeneralByPhone(String phone);
}
